package copyproperties;

import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;

@Document(collection = "userpayment")
public class UserPayment {

    @Id
    private String id;

    @Excel(name = "充值编号", orderNum = "0", width = 20)
    private String tradeNo = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());

    @Excel(name = "用户", orderNum = "4", width = 20)
    private String username;

    @Excel(name = "充值金额", orderNum = "3", width = 20)
    private BigDecimal amount;

    private boolean succeed;

    //支付日期
    private Date paymentDate = new Date();

    @Excel(name = "充值时间", orderNum = "1", width = 20)
    private String paymentDateStr;

    /**
     * 上一次充值日期
     */
    private Date lastPaymentDate;

    /**
     * 格式化的上次充值时间
     */
    @Excel(name = "上一次充值时间", orderNum = "2", width = 20)
    private String lastChargeTime;

    @Excel(name = "充值方式", orderNum = "5", width = 20, replace = {"微信_WECHAT", "支付宝_ALIPAY", "对公转账_BANK", "手动充值_MANUAL", "赠送充值_PRESENTED"})
    private PaymentMethod paymentMethod;

    @Excel(name = "渠道编号", orderNum = "8", width = 20)
    private String channelNumber;

    @Excel(name = "开票状态", orderNum = "9", width = 20, replace = {"已开票_PROCESSED", "已开票_null", "未开票_UNPROCESSED"})
    private PaymentState state;

    @Excel(name = "发票抬头", orderNum = "10", width = 40)
    private String invoiceTitle;

    private String transId;

    //操作员
    @Excel(name = "操作人", orderNum = "7", width = 20)
    private String operator = "SYSTEM";

    //支付类型：首充、续费
    @Excel(name = "充值类型", orderNum = "6", width = 20, replace = {"首充_FIRSTCHARGE", "续费_RENEW"})
    private PayType payType = PayType.RENEW;

    //交易日期
    private Date tradeDate;

    //付款人姓名
    private String payUserName;

    //付款人账号
    private String cardNumber;

    //开户行
    private String accountsBank;

    //流水号
    private String sequenceNumber;

    /** 微信支付id*/
    private String prepayId;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTradeNo() {
        return tradeNo;
    }

    public void setTradeNo(String tradeNo) {
        this.tradeNo = tradeNo;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public boolean isSucceed() {
        return succeed;
    }

    public void setSucceed(boolean succeed) {
        this.succeed = succeed;
    }

    public Date getPaymentDate() {
        return paymentDate;
    }

    public void setPaymentDate(Date paymentDate) {
        this.paymentDate = paymentDate;
    }

    public PaymentMethod getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(PaymentMethod paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

    public String getTransId() {
        return transId;
    }

    public void setTransId(String transId) {
        this.transId = transId;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public PayType getPayType() {
        return payType;
    }

    public void setPayType(PayType payType) {
        this.payType = payType;
    }

    public String getPayUserName() {
        return payUserName;
    }

    public void setPayUserName(String payUserName) {
        this.payUserName = payUserName;
    }

    public String getCardNumber() {
        return cardNumber;
    }

    public void setCardNumber(String cardNumber) {
        this.cardNumber = cardNumber;
    }

    public String getAccountsBank() {
        return accountsBank;
    }

    public void setAccountsBank(String accountsBank) {
        this.accountsBank = accountsBank;
    }

    public String getSequenceNumber() {
        return sequenceNumber;
    }

    public void setSequenceNumber(String sequenceNumber) {
        this.sequenceNumber = sequenceNumber;
    }

    public String getChannelNumber() {
        return channelNumber;
    }

    public void setChannelNumber(String channelNumber) {
        this.channelNumber = channelNumber;
    }

    public String getPaymentDateStr() {
        return paymentDateStr;
    }

    public void setPaymentDateStr(String paymentDateStr) {
        this.paymentDateStr = paymentDateStr;
    }

    public Date getTradeDate() {
        return tradeDate;
    }

    public void setTradeDate(Date tradeDate) {
        this.tradeDate = tradeDate;
    }

    public PaymentState getState() {
        return state;
    }

    public void setState(PaymentState state) {
        this.state = state;
    }

    public String getInvoiceTitle() {
        return invoiceTitle;
    }

    public void setInvoiceTitle(String invoiceTitle) {
        this.invoiceTitle = invoiceTitle;
    }

    public enum PayType {
        FIRSTCHARGE,
        RENEW
    }

    public enum PaymentState {
        /**
         * 未开票
         */
        UNPROCESSED,
        /**
         * 已开票
         */
        PROCESSED
    }

    public String getPrepayId() {
        return prepayId;
    }

    public void setPrepayId(String prepayId) {
        this.prepayId = prepayId;
    }

    public String getLastChargeTime() {
        return lastChargeTime;
    }

    public void setLastChargeTime(String lastChargeTime) {
        this.lastChargeTime = lastChargeTime;
    }

    public Date getLastPaymentDate() {
        return lastPaymentDate;
    }

    public void setLastPaymentDate(Date lastPaymentDate) {
        this.lastPaymentDate = lastPaymentDate;
    }
}
